package top.infopub.enums.cap;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*金融机构审批环节枚举类*/
public enum FinancialInstitutionsLinkEnum {


    RECEIVER_TYPE1("1", "初步商洽"),
    RECEIVER_TYPE2("2", "汇总各种融资要素"),
    RECEIVER_TYPE3("3", "成立项目公司"),
    RECEIVER_TYPE4("4", "项目公司开立基本户"),
    RECEIVER_TYPE5("5", "客户评级"),
    RECEIVER_TYPE6("6", "项目准入"),
    RECEIVER_TYPE7("7", "项目评估"),
    RECEIVER_TYPE8("8", "支行授信报告"),
    RECEIVER_TYPE9("9", "两证上报"),
    RECEIVER_TYPE10("10", "地级分行公司部"),
    RECEIVER_TYPE11("11", "地级分行信审部"),
    RECEIVER_TYPE12("12", "地级分行上会"),
    RECEIVER_TYPE13("13", "省分行公司部"),
    RECEIVER_TYPE14("14", "省分行信审部"),
    RECEIVER_TYPE15("15", "省行上会"),
    RECEIVER_TYPE16("16", "牵出批复"),
    RECEIVER_TYPE17("17", "上报总行公司部"),
    RECEIVER_TYPE18("18", "总行信审部");

    private String code;

    private String name;

    FinancialInstitutionsLinkEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static FinancialInstitutionsLinkEnum getByCode(String code) {
        if (StringUtils.isBlank(code)) return null;
        for (FinancialInstitutionsLinkEnum pidte : FinancialInstitutionsLinkEnum.values()) {
            if (StringUtils.equals(code, pidte.getCode())) {
                return pidte;
            }
        }
        return null;
    }

    public static List<Map<String, String>> asList() {
        List<Map<String, String>> list = new ArrayList<>();
        Map<String, String> map;
        for (FinancialInstitutionsLinkEnum pidte : FinancialInstitutionsLinkEnum.values()) {
            map = new HashMap<>();
            map.put("code", pidte.getCode());
            map.put("name", pidte.getName());
            list.add(map);
        }
        return list;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
